package com.hnluchuan.staff.web.controller.admin;

import java.io.IOException;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;

import com.hnluchuan.staff.common.UserType;
import com.hnluchuan.staff.dto.*;
import com.hnluchuan.staff.model.Employee;
import com.hnluchuan.staff.model.User;
import com.hnluchuan.staff.service.*;
import com.hnluchuan.utils.exception.BizException;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.hnluchuan.staff.dto.EmployeeDTO;
import com.hnluchuan.staff.service.EmployeeService;

import com.hnluchuan.core.support.Page;
import com.hnluchuan.staff.web.controller.BaseController;

import javax.servlet.http.HttpServletResponse;

@Controller
@RequestMapping(value = "/admin/employee", produces="text/html;charset=UTF-8")
public class AdminEmployeeController extends BaseController {

	@Autowired
	private EmployeeService employeeService;
	@Autowired
	private EducationService educationService;
	@Autowired
	private ExperienceService experienceService;
	@Autowired
	private EmergencyContactService emergencyContactService;
	@Autowired
	private FamilyService familyService;

	@RequestMapping(value = "/detail")
	public String detail(Map<String, Object> map, Long id, HttpServletResponse response) throws  Exception{
           User user=getCurrentUserDTO();
           EmployeeDTO employeeDTO = new EmployeeDTO();
           employeeDTO.setUser(user);
           employeeDTO.getUser();
          EmployeeDTO employeeDTO1= employeeService.findOne(employeeDTO);
		if(employeeDTO1 != null){
			   /* response.setCharacterEncoding("utf-8");
				PrintWriter out = response.getWriter();
				out.print("<script type=\"text/javascript\">alert('您还没有登录，请登录...');  </script>");
				out.flush();
				out.close();*/

			//throw new BizException("不能再次添加个人信息");

			return  "admin/exception/repeat_upload";
		}

		if (id != null) {
			EmployeeDTO dto = employeeService.load(id);

			EmergencyContactDTO emergencyContactDTO = new EmergencyContactDTO();
			emergencyContactDTO.setEmployee(new Employee());
			emergencyContactDTO.getEmployee().setId(id);
			List<EmergencyContactDTO> emergencyContactDTOS = emergencyContactService.find(emergencyContactDTO,null);

			EducationDTO query = new EducationDTO();
			query.setEmployee(new Employee());
			query.getEmployee().setId(id);
			List<EducationDTO> educationDTOS = educationService.find(query,null);

			ExperienceDTO experienceDTO = new ExperienceDTO();
			experienceDTO.setEmployee(new Employee());
			experienceDTO.getEmployee().setId(id);
			List<ExperienceDTO> experienceDTOS = experienceService.find(experienceDTO,null);

			FamilyDTO familyDTO = new FamilyDTO();
			familyDTO.setEmployee(new Employee());
			familyDTO.getEmployee().setId(id);
			List<FamilyDTO> familyDTOS = familyService.find(familyDTO,null);

			map.put("family",familyDTOS);
			map.put("emergency",emergencyContactDTOS);
			map.put("education",educationDTOS);
			map.put("experience",experienceDTOS);
			map.put("n", dto);
			return "admin/detail_list";

		}
		//return "admin/employee/employee_detail";
		return "admin/employee_details";
	}

	@RequestMapping(value = "/details4")
	public String details4(Map<String, Object> map) {
		UserDTO userDTO=getCurrentUserDTO();
		EmployeeDTO dto = new EmployeeDTO();
		dto.setUser(userDTO);
		Employee employee=employeeService.findOne(dto);
		if(employee==null){
			return "admin/exception/first_emp_excep";
		}
		Long id= employee.getId();

		EmergencyContactDTO emergencyContactDTO = new EmergencyContactDTO();
		emergencyContactDTO.setEmployee(new Employee());
		emergencyContactDTO.getEmployee().setId(id);
		List<EmergencyContactDTO> emergencyContactDTOS = emergencyContactService.find(emergencyContactDTO,null);

		EducationDTO query = new EducationDTO();
		query.setEmployee(new Employee());
		query.getEmployee().setId(id);
		List<EducationDTO> educationDTOS = educationService.find(query,null);

		ExperienceDTO experienceDTO = new ExperienceDTO();
		experienceDTO.setEmployee(new Employee());
		experienceDTO.getEmployee().setId(id);
		List<ExperienceDTO> experienceDTOS = experienceService.find(experienceDTO,null);

		FamilyDTO familyDTO = new FamilyDTO();
		familyDTO.setEmployee(new Employee());
		familyDTO.getEmployee().setId(id);
		List<FamilyDTO> familyDTOS = familyService.find(familyDTO,null);

		map.put("family",familyDTOS);
		map.put("emergency",emergencyContactDTOS);
		map.put("education",educationDTOS);
		map.put("experience",experienceDTOS);
		map.put("n",employee);
		//return "admin/detail_list";
			return "admin/detail_list";


	}

	@RequestMapping(value = "/detail1")
	public String detail1(Map<String, Object> map, Long id) {
		if (id != null) {
			EmployeeDTO dto = employeeService.load(id);

			EmergencyContactDTO emergencyContactDTO = new EmergencyContactDTO();
			emergencyContactDTO.setEmployee(new Employee());
			emergencyContactDTO.getEmployee().setId(id);
			List<EmergencyContactDTO> emergencyContactDTOS = emergencyContactService.find(emergencyContactDTO,null);

			EducationDTO query = new EducationDTO();
			query.setEmployee(new Employee());
			query.getEmployee().setId(id);
			List<EducationDTO> educationDTOS = educationService.find(query,null);

			ExperienceDTO experienceDTO = new ExperienceDTO();
			experienceDTO.setEmployee(new Employee());
			experienceDTO.getEmployee().setId(id);
			List<ExperienceDTO> experienceDTOS = experienceService.find(experienceDTO,null);

			FamilyDTO familyDTO = new FamilyDTO();
			familyDTO.setEmployee(new Employee());
			familyDTO.getEmployee().setId(id);
			List<FamilyDTO> familyDTOS = familyService.find(familyDTO,null);

			map.put("family",familyDTOS);
			map.put("emergency",emergencyContactDTOS);
			map.put("education",educationDTOS);
			map.put("experience",experienceDTOS);
			map.put("n", dto);
			//return "admin/detail_list";
		}
		return "admin/detailAlls";
	}

	@RequestMapping(value = "/detail3")
	public String detail3(Map<String, Object> map, Long id) {
		if (id != null) {
			EmployeeDTO dto = employeeService.load(id);

			EmergencyContactDTO emergencyContactDTO = new EmergencyContactDTO();
			emergencyContactDTO.setEmployee(new Employee());
			emergencyContactDTO.getEmployee().setId(id);
			List<EmergencyContactDTO> emergencyContactDTOS = emergencyContactService.find(emergencyContactDTO,null);

			EducationDTO query = new EducationDTO();
			query.setEmployee(new Employee());
			query.getEmployee().setId(id);
			List<EducationDTO> educationDTOS = educationService.find(query,null);

			ExperienceDTO experienceDTO = new ExperienceDTO();
			experienceDTO.setEmployee(new Employee());
			experienceDTO.getEmployee().setId(id);
			List<ExperienceDTO> experienceDTOS = experienceService.find(experienceDTO,null);

			FamilyDTO familyDTO = new FamilyDTO();
			familyDTO.setEmployee(new Employee());
			familyDTO.getEmployee().setId(id);
			List<FamilyDTO> familyDTOS = familyService.find(familyDTO,null);

			map.put("family",familyDTOS);
			map.put("emergency",emergencyContactDTOS);
			map.put("education",educationDTOS);
			map.put("experience",experienceDTOS);
			map.put("n", dto);
			//return "admin/detail_list";
		}
		return "admin/xiugai";
	}

	@RequestMapping(value = "/detailp")
	public String detailp(Map<String, Object> map, Long id) {
		if (id != null) {
			EmployeeDTO dto = employeeService.load(id);

			EmergencyContactDTO emergencyContactDTO = new EmergencyContactDTO();
			emergencyContactDTO.setEmployee(new Employee());
			emergencyContactDTO.getEmployee().setId(id);
			List<EmergencyContactDTO> emergencyContactDTOS = emergencyContactService.find(emergencyContactDTO,null);

			EducationDTO query = new EducationDTO();
			query.setEmployee(new Employee());
			query.getEmployee().setId(id);
			List<EducationDTO> educationDTOS = educationService.find(query,null);

			ExperienceDTO experienceDTO = new ExperienceDTO();
			experienceDTO.setEmployee(new Employee());
			experienceDTO.getEmployee().setId(id);
			List<ExperienceDTO> experienceDTOS = experienceService.find(experienceDTO,null);

			FamilyDTO familyDTO = new FamilyDTO();
			familyDTO.setEmployee(new Employee());
			familyDTO.getEmployee().setId(id);
			List<FamilyDTO> familyDTOS = familyService.findAll(familyDTO);

			map.put("family",familyDTOS);
			map.put("emergency",emergencyContactDTOS);
			map.put("education",educationDTOS);
			map.put("experience",experienceDTOS);
			map.put("n", dto);
			//return "admin/detail_list";
		}
		return "admin/xiugaip";
	}

	@RequestMapping(value = "/detail2")
	public String detail2(Map<String, Object> map) {
		UserDTO userDTO=getCurrentUserDTO();
		EmployeeDTO dto = new EmployeeDTO();
		dto.setUser(userDTO);
		Employee employee=employeeService.findOne(dto);
		if(employee==null){
			return "admin/exception/first_emp_excep";
		}
		Long id= employee.getId();

			EmergencyContactDTO emergencyContactDTO = new EmergencyContactDTO();
			emergencyContactDTO.setEmployee(new Employee());
			emergencyContactDTO.getEmployee().setId(id);
			List<EmergencyContactDTO> emergencyContactDTOS = emergencyContactService.find(emergencyContactDTO,null);

			EducationDTO query = new EducationDTO();
			query.setEmployee(new Employee());
			query.getEmployee().setId(id);
			List<EducationDTO> educationDTOS = educationService.find(query,null);

			ExperienceDTO experienceDTO = new ExperienceDTO();
			experienceDTO.setEmployee(new Employee());
			experienceDTO.getEmployee().setId(id);
			List<ExperienceDTO> experienceDTOS = experienceService.find(experienceDTO,null);

			FamilyDTO familyDTO = new FamilyDTO();
			familyDTO.setEmployee(new Employee());
			familyDTO.getEmployee().setId(id);
			List<FamilyDTO> familyDTOS = familyService.find(familyDTO,null);

			map.put("family",familyDTOS);
			map.put("emergency",emergencyContactDTOS);
			map.put("education",educationDTOS);
			map.put("experience",experienceDTOS);
			map.put("n",employee);
			//return "admin/detail_list";

		return "admin/xiugai";
	}

	@RequestMapping(value = "/detailAll")
	public String detailAll(Map<String, Object> map, Long id) {

		if (id != null) {
			EmployeeDTO dto = employeeService.load(id);
			map.put("n", dto);
		}
		return "admin/detailAlls";
	}

	@RequestMapping(value = "/detailOne")
	public String detailOne(Map<String, Object> map, Long id) {
		if (id != null) {
			EmployeeDTO dto = employeeService.load(id);
			map.put("n", dto);
		}
		return "admin/detail";
	}
	
	@ResponseBody
	@RequestMapping(value = "/save")
	public String save(EmployeeDTO dto,EducationDTO educationDTO,ExperienceDTO experienceDTO,FamilyDTO familyDTO,EmergencyContactDTO emergencyContactDTO) throws Exception {
		UserDTO userDTO=getCurrentUserDTO();
		dto.setUser(userDTO);
		dto.setDeleted(false);
		experienceDTO.setDeleted(false);
		educationDTO.setDeleted(false);
		emergencyContactDTO.setDeleted(false);
		familyDTO.setDeleted(false);
			if (dto.getId() == null) {

				Long id = employeeService.create(dto);

				educationDTO.setDeleted(false);
				educationDTO.setEmployee(new Employee());
				educationDTO.getEmployee().setId(id);
				educationService.create(educationDTO);

				experienceDTO.setEmployee(new Employee());
				experienceDTO.getEmployee().setId(id);
				experienceService.create(experienceDTO);

				familyDTO.setEmployee(new Employee());
				familyDTO.getEmployee().setId(id);
				familyService.create(familyDTO);

					emergencyContactDTO.setEmployee(new Employee());
					emergencyContactDTO.getEmployee().setId(id);
					emergencyContactService.create(emergencyContactDTO);
					}


			else {
				employeeService.updateAllFields(dto);
			    educationService.updateAllFields(educationDTO);
				experienceService.updateAllFields(experienceDTO);
				familyService.updateAllFields(familyDTO);
				emergencyContactService.updateAllFields(emergencyContactDTO);
			}

		return ok();
	}

	@ResponseBody
	@RequestMapping(value = "/savep")
	public String savep(EmployeeDTO dto) throws Exception {
		UserDTO userDTO=getCurrentUserDTO();
		dto.setUser(userDTO);
		dto.setDeleted(false);
		if (dto.getId() == null) {
			Long id = employeeService.create(dto);
		}
		else {
			employeeService.updateAllFields(dto);
		}
		return ok();
	}

	@ResponseBody
	@RequestMapping(value = "/savep1")
	public String savep1(EmployeeDTO dto) throws Exception {
		dto.setDeleted(false);
		if (dto.getId() == null) {
			Long id = employeeService.create(dto);
		}
		else {
			employeeService.updateAllFields(dto);
		}
		return ok();
	}

	@RequestMapping(value = "/save1")
	public String save1(EmployeeDTO dto, String [] start,String [] end,String [] majors,Integer [] record,String [] certificate,
					   String []em_name, String [] relation,String [] em_phone,String []em_address,
					   String [] reason, String [] company,String [] work,String [] ex_position,String []ex_start,String[] ex_end,
					   String[] f_name,String[] f_relation,String[]contact,Integer []age,String [] f_company,String []f_position) throws Exception {

		if (dto.getId() == null) {
			UserDTO userDTO=getCurrentUserDTO();
			dto.setUser(userDTO);
			dto.setDeleted(false);
			Long u_id=employeeService.create(dto);

			for(int i = 0; (i<start.length) && StringUtils.isNotBlank(start[i]); i++) {
				EducationDTO e=new EducationDTO();
				e.setEmployee(dto);
				e.getEmployee().setId(u_id);
				e.setDeleted(false);
				if((i<start.length) && StringUtils.isNotBlank(start[i])){
					Date s=new SimpleDateFormat("yyyy-MM-dd").parse(start[i]);
					e.setStart(s);}
				if((i<end.length)&& StringUtils.isNotBlank(end[i])){
					Date en=new SimpleDateFormat("yyyy-MM-dd").parse(end[i]);
					e.setEnd(en);}
				if(i<majors.length)
					e.setEdmajor(majors[i]);
				if(i<record.length)
					e.setRecord(record[i]);
				if(i<certificate.length)
					e.setCertificate(certificate[i]);
				educationService.create(e);
			}

			for(int i=0;(i<em_name.length) && StringUtils.isNotBlank(em_name[i]);i++) {
				EmergencyContactDTO em=new EmergencyContactDTO();
				em.setEmployee(dto);
				em.getEmployee().setId(u_id);
				em.setDeleted(false);
				if(i<em_name.length)
					em.setEmname(em_name[i]);
				if(i<relation.length)
					em.setRelation(relation[i]);
				if(i<em_phone.length)
					em.setEmphone(em_phone[i]);
				if(i<em_address.length)
					em.setEmaddress(em_address[i]);
				emergencyContactService.create(em);
			}

			for(int i=0;(i<ex_start.length ) && StringUtils.isNotBlank(ex_start[i]);i++) {
				ExperienceDTO ex=new ExperienceDTO();
				ex.setEmployee(dto);
				ex.getEmployee().setId(u_id);
				ex.setDeleted(false);
				if(i<reason.length)
					ex.setReason(reason[i]);
				if(i<company.length)
					ex.setCompany(company[i]);
				if(i<work.length)
					ex.setWork(work[i]);
				if(i<ex_position.length)
					ex.setPosition1(ex_position[i]);
				if((i<ex_start.length) && StringUtils.isNotBlank(ex_start[i])){
					Date st=new SimpleDateFormat("yyyy-MM-dd").parse(ex_start[i]);
					ex.setExstart(st);}
				if(i<ex_end.length  && StringUtils.isNotBlank(ex_end[i])){
					Date en=new SimpleDateFormat("yyyy-MM-dd").parse(ex_end[i]);
					ex.setExend(en);}
				experienceService.create(ex);
			}

			for(int i=0;(i<f_name.length) && StringUtils.isNotBlank(f_name[i]);i++) {
				FamilyDTO f=new FamilyDTO();
				f.setEmployee(dto);
				f.getEmployee().setId(u_id);
				f.setDeleted(false);
				if(i<f_name.length)
					f.setFaname(f_name[i]);
				if(i<f_relation.length)
					f.setFarelation(f_relation[i]);
				if(i<contact.length)
					f.setContact(contact[i]);
				if(i<age.length)
					f.setAge(age[i]);
				if(i<f_company.length)
					f.setFacompany(f_company[i]);
				if(i<f_position.length)
					f.setPosition2(f_position[i]);
				familyService.create(f);
			}
		}
		return "redirect:/admin/employee/details4";
	}
/*	@ResponseBody
	@RequestMapping(value = "/delete9")
	public String show(Long[] ids) throws Exception {
	employeeService.deleteByIds(ids);
		for(Long id : ids){
			EmployeeDTO employeeDTO= employeeService.load(id);
			EmployeeDTO old = employeeService.load(id);
			old.setStatus(employeeDTO.getStatus());
			employeeService.updateAllFields(old);
			}

		return ok();
	}*/
	/**再次入职*/
	@ResponseBody
	@RequestMapping(value = "/regular")
	public String regular(Long[] ids) throws IOException {
		/*employeeService.deleteByIds(ids);*/
		for (Long id : ids) {
			/*EmployeeDTO employeeDTO= employeeService.load(id);*/
			EmployeeDTO old = employeeService.load(id);
			old.setStatus(0);
			long userid = old.getUser().getId();
			UserDTO userDTO =userService.load(userid);
			userDTO.setDeleted(false);
	 userService.updateAllFields(userDTO);
	 /*userService.updateAllFields(userDTO);*/

			employeeService.updateAllFields(old);
}
		return ok();
				}
	/**离职*/
	@ResponseBody
	@RequestMapping(value = "/delete")
	public String delete(Long[] ids) throws IOException {
		/*employeeService.deleteByIds(ids);*/
		for(Long id : ids){
			EmployeeDTO old = employeeService.load(id);
			old.setStatus(1);
			long userid = old.getUser().getId();
			UserDTO userDTO =userService.load(userid);
			userDTO.setDeleted(true);
			userService.updateAllFields(userDTO);
			employeeService.updateAllFields(old);
			/*employeeDTO.setDeleted(false);
			employeeService.updateAllFields(employeeDTO);*/
			/*User user = employeeDTO.getUser();
			userService.deleteById(user.getId());
			//进行学历删除
			Long id1 = employeeDTO.getId();
			EducationDTO educationDTO = new EducationDTO();
			educationDTO.setEmployee(new Employee());
			educationDTO.getEmployee().setId(id1);
			List<EducationDTO> educationDTOS = educationService.find(educationDTO,null);
			for ( EducationDTO dto: educationDTOS) {
				educationService.deleteById(dto.getEdid());
			}
			//进行家庭联系人删除
			FamilyDTO familyDTO = new FamilyDTO();
			familyDTO.setEmployee(new Employee());
			familyDTO.getEmployee().setId(id1);
			List<FamilyDTO> familyDTOS = familyService.find(familyDTO,null);
			for (FamilyDTO dto: familyDTOS){
				familyService.deleteById(dto.getFaid());
			}

			//进行紧急联系人删除
			EmergencyContactDTO emergencyContactDTO = new EmergencyContactDTO();
			emergencyContactDTO.setEmployee(new Employee());
			emergencyContactDTO.getEmployee().setId(id1);
			List<EmergencyContactDTO> emergencyContactDTOS = emergencyContactService.find(emergencyContactDTO,null);
			for (EmergencyContactDTO dto :emergencyContactDTOS){
				emergencyContactService.deleteById(dto.getEmid());
			}

			//进行工作经历删除
			ExperienceDTO experienceDTO = new ExperienceDTO();
			experienceDTO.setEmployee(new Employee());
			experienceDTO.getEmployee().setId(id1);
			List<ExperienceDTO> experienceDTOS = experienceService.find(experienceDTO,null);
			for (ExperienceDTO dto : experienceDTOS){
				experienceService.deleteById(dto.getExid());*/
				/*dto.setDeleted(false);
				experienceService.updateAllFields(dto);*/

		}

		return ok();
	}
	
	@RequestMapping(value = "/list")
	public String list(EmployeeDTO dto, Boolean search, Map<String, Object> map, Page page) {
		UserDTO userDTO=getCurrentUserDTO();
		if(userDTO.getType()!= 1){
		dto.setUser(userDTO);
		}
		List<EmployeeDTO> dtos = employeeService.find(dto, page);
		map.put("list", dtos);
		map.put("query", dto);
		map.put("search", search);
		map.put("n", dto);
		String ss=null;
		return "admin/employee/employee_list";
	}
	
	@RequestMapping(value = "/search")
	public String search(EmployeeDTO dto, Map<String, Object> map, Page page) {
		List<EmployeeDTO> dtos = employeeService.find(dto, page);
		map.put("list", dtos);
		map.put("query", dto);
		return "admin/employee/employee_search";
	}

	//管理查看员工信息时，修改的功能
	@RequestMapping(value = "/test")
	public String test(Map<String, Object> map,Long ids) {
		//UserDTO userDTO=getCurrentUserDTO();
		EmployeeDTO dto = new EmployeeDTO();
		//UserDTO user= new UserDTO();
		//user.setId(userId);
		dto.setId(ids);
		Employee employee=employeeService.findOne(dto);
		/*if(employee==null){
			return "admin/exception/first_emp_excep";
		}*/
		Long id= employee.getId();

		EmergencyContactDTO emergencyContactDTO = new EmergencyContactDTO();
		emergencyContactDTO.setEmployee(new Employee());
		emergencyContactDTO.getEmployee().setId(id);
		List<EmergencyContactDTO> emergencyContactDTOS = emergencyContactService.find(emergencyContactDTO,null);

		EducationDTO query = new EducationDTO();
		query.setEmployee(new Employee());
		query.getEmployee().setId(id);
		List<EducationDTO> educationDTOS = educationService.find(query,null);

		ExperienceDTO experienceDTO = new ExperienceDTO();
		experienceDTO.setEmployee(new Employee());
		experienceDTO.getEmployee().setId(id);
		List<ExperienceDTO> experienceDTOS = experienceService.find(experienceDTO,null);

		FamilyDTO familyDTO = new FamilyDTO();
		familyDTO.setEmployee(new Employee());
		familyDTO.getEmployee().setId(id);
		List<FamilyDTO> familyDTOS = familyService.find(familyDTO,null);

		map.put("family",familyDTOS);
		map.put("emergency",emergencyContactDTOS);
		map.put("education",educationDTOS);
		map.put("experience",experienceDTOS);
		map.put("n",employee);
		//return "admin/detail_list";

		return "admin/xiugai_admin";
	}


	//管理员查看用户详情功能
	@RequestMapping(value = "/test2")
	public String test2(Map<String, Object> map, Long id, HttpServletResponse response) throws  Exception{
//		User user=getCurrentUserDTO();
//		EmployeeDTO employeeDTO = new EmployeeDTO();
//		employeeDTO.setUser(user);
//		employeeDTO.getUser();
//		EmployeeDTO employeeDTO1= employeeService.findOne(employeeDTO);
//
//
//		if (id != null) {
			EmployeeDTO dto = employeeService.load(id);

			EmergencyContactDTO emergencyContactDTO = new EmergencyContactDTO();
			emergencyContactDTO.setEmployee(new Employee());
			emergencyContactDTO.getEmployee().setId(id);
			List<EmergencyContactDTO> emergencyContactDTOS = emergencyContactService.find(emergencyContactDTO,null);

			EducationDTO query = new EducationDTO();
			query.setEmployee(new Employee());
			query.getEmployee().setId(id);
			List<EducationDTO> educationDTOS = educationService.find(query,null);

			ExperienceDTO experienceDTO = new ExperienceDTO();
			experienceDTO.setEmployee(new Employee());
			experienceDTO.getEmployee().setId(id);
			List<ExperienceDTO> experienceDTOS = experienceService.find(experienceDTO,null);

			FamilyDTO familyDTO = new FamilyDTO();
			familyDTO.setEmployee(new Employee());
			familyDTO.getEmployee().setId(id);
			List<FamilyDTO> familyDTOS = familyService.find(familyDTO,null);

			map.put("family",familyDTOS);
			map.put("emergency",emergencyContactDTOS);
			map.put("education",educationDTOS);
			map.put("experience",experienceDTOS);
			map.put("n", dto);
			return "admin/detail_list2";

		}
		//return "admin/employee/employee_detail";
//		return "admin/employee_details";
//	}
	
}
